<?php
/**
 * Page.php
 *
 * @package     Madoqua
 * @package     Module
 * @subpackage  BlogAdmin
 */

/** base class */
require_once 'Madoqua/Form.php';

/** madoqua html filter */
require_once 'Madoqua/Filter/Html.php';

/** html entities filter */
require_once 'Zend/Filter/HtmlEntities.php';

/**
 * BlogAdming_Page_Page
 *
 * @package     Madoqua
 * @package     Module
 * @subpackage  BlogAdmin
 */
class BlogAdmin_Page_Page extends Madoqua_Form
{
    /**
     * constructor
     */
    public function __construct() {
        parent::__construct();
         
        $noHtml = new Zend_Filter_HtmlEntities(ENT_COMPAT, 'UTF-8');
        //htmlentities filter for non-html fields
              
        $this->addElement('text', 'title', array(
            'label' => 'Title',
            'required' => true,
            'validators' => array(
                array('stringLength', false, array(3, 255))
            ),
            'filters' => array(
                $noHtml
            )
        ));
        //title
        
        $this->addElement('textarea', 'content', array(
            'label' => 'Contents',
            'required' => true,
            'validators' => array(
            ),
            'filters' => array(
                new Madoqua_Filter_Html()
            )
        ));
        //content
        
        $this->addElement('text', 'slug', array(
            'label' => 'Slug',    
            'required' => true,
            'validators' => array(
                array('stringLength', false, array(3, 255))
            ),
            'filters' => array(
                $noHtml
            )
        ));
        //slug
        
        $this->addElement('submit', 's', array(
            'label' => 'Submit'
        ));
        //submit
    }
}